const { createHash } = require("crypto");
const {
  developerRoleID,
  developerID,
  masterRoleID,
  masterID,
  adminRoleID,
  rootID
} = require("../generator");

module.exports = {
  up: (queryInterface, Sequelize) => {
    return queryInterface.bulkInsert(
      "t_role_user",
      [
        {
          id: `${Math.random() * Date.now()}`,
          role_id: developerRoleID,
          user_id: developerID,
          create_user_id: rootID,
          modify_user_id: rootID,
          create_time: new Date(),
          modify_time: new Date()
        },
        {
          id: `${Math.random() * Date.now()}`,
          role_id: masterRoleID,
          user_id: masterID,
          create_user_id: rootID,
          modify_user_id: rootID,
          create_time: new Date(),
          modify_time: new Date()
        },
        {
          id: `${Math.random() * Date.now()}`,
          role_id: adminRoleID,
          user_id: rootID,
          create_user_id: rootID,
          modify_user_id: rootID,
          create_time: new Date(),
          modify_time: new Date()
        }
      ],
      {}
    );
  },

  down: (queryInterface, Sequelize) => {
    return queryInterface.bulkDelete("t_role_user", null, {});
  }
};
